package top.hidoctor.auscultation.adapter;

import android.graphics.Color;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tang.util.TimeUtil;

import java.util.List;

import top.hidoctor.auscultation.R;
import top.hidoctor.auscultation.bean.BaizhubaoListBean;

public class BzrenwubaoAdapter extends BaseQuickAdapter<BaizhubaoListBean.ResultBean> {
    public BzrenwubaoAdapter(int layoutResId, List<BaizhubaoListBean.ResultBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BaizhubaoListBean.ResultBean item) {
        TextView tv_status = helper.getView(R.id.tv_status);
        switch (item.getStatus()) { //10:标注开始；20：标注完成;30:标注超时
            case 10:
                tv_status.setText("标注开始");
                tv_status.setTextColor(mContext.getResources().getColor(R.color.main_yellow));
                tv_status.setBackgroundResource(R.drawable.bg_yellow_8_2);
                break;
            case 20:
                tv_status.setText("标注完成");
                tv_status.setTextColor(mContext.getResources().getColor(R.color.blue_main));
                tv_status.setBackgroundResource(R.drawable.bg_blue_8_2);
                break;
            case 30:
                tv_status.setText("标注超时");
                tv_status.setTextColor(Color.parseColor("#CE4C4C"));
                tv_status.setBackgroundResource(R.drawable.bg_red_8_2);
                break;
        }
        helper.setText(R.id.tv_name, item.getName())
                .setText(R.id.tv_time, TimeUtil.formatTime(item.getCreatedTime(), TimeUtil.Y_M_D_2) + " - " + TimeUtil.formatTime(item.getExpiryTime(), TimeUtil.Y_M_D_2))
                .setText(R.id.tv_wenjian, item.getSampleTotal() + "")
                .setText(R.id.tv_yihsi, item.getMarkEmpTotal() + "");
    }
}
